import { Device } from './../../models/device';
import { ExpeditionOrder } from './../../models/expeditionOrder';
import { IMessageHandle, IMessageStruct } from './messageHandleManager';

export class ExpeditionOrderMessageHandle implements IMessageHandle {
    get MessageName() { return "expeditionOrder"; }
    get HandleName() { return "ExpeditionOrderessageHandle"; }
    OnReceived(sender, args: IMessageStruct) {
        this.OnMessage && this.OnMessage(args.body);
    }

    OnMessage: (order: ExpeditionOrder) => void;
}

export class DeviceMessageHandle implements IMessageHandle {
    get MessageName() { return "device"; }
    get HandleName() { return "DeviceMessageHandle"; }
    OnReceived(sender, args: IMessageStruct) {
        this.OnMessage && this.OnMessage(args.body);
    }

    OnMessage: (Device: Device) => void;
}

export interface SoldOutMessageData {
    id: string;
    isSoldOut: boolean;
    soldOutMode: string;
}

export class SoldOutMessageHandle implements IMessageHandle {
    get MessageName() { return "soldOut"; }
    get HandleName() { return "SoldOutMessageHandle"; }
    OnReceived(sender, args: IMessageStruct) {
        this.OnMessage && this.OnMessage(args.body);
    }

    OnMessage: (soldOuts: SoldOutMessageData[]) => void;
}